package api

import (
	"360-cinema/api-getaway/basic/config"
	"360-cinema/api-getaway/basic/handler/request"
	__ "360-cinema/api-getaway/basic/videoProto"
	"github.com/gin-gonic/gin"
	"log"
	"net/http"
)

func VideoStatus(c *gin.Context) {

	var video request.VideoStatus
	err := c.ShouldBind(&video)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{
			"code": 0,
			"msg":  "参数错误",
		})
		return
	}
	r, err := config.VideoClient.VideoStatus(c, &__.VideoStatusReq{
		VideoId: video.VideoId,
		Status:  video.Status,
		Reject:  video.Reject,
	})
	if err != nil {
		return
	}
	if err != nil {
		log.Fatalf("could not greet: %v", err)
	}
	c.JSON(http.StatusOK, gin.H{
		"code": r.Code,
		"msg":  r.Msg,
		"data": r.Data,
	})
}
